<%@page import="com.google.gson.Gson"%>
<%@page import="com.google.gson.GsonBuilder"%>
<%@page import="com.zx.baike.util.UEditorTemplateConfig"%>
<%@page import="com.zx.framework.core.env.Environment"%>
<%@page import="com.zx.framework.core.util.FileUtil"%>
<%@page import="com.zx.framework.core.util.SpringBeanUtil"%>
<%@page import="java.io.File"%>
<%@page import="java.util.ArrayList"%>
<%@page language="java" import="java.util.List" pageEncoding="utf-8"%>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Map.Entry" %>
<%
	Map<String,UEditorTemplateConfig> templates = SpringBeanUtil.getBean("ueditorMap", Map.class);
	Gson gson = new GsonBuilder().disableHtmlEscaping().create();
    List<UEditorTemplateConfig> utcs = new ArrayList<UEditorTemplateConfig>();
	for(Entry<String,UEditorTemplateConfig> en  : templates.entrySet()){
		UEditorTemplateConfig utc = en.getValue();
		utc.setPreHtml(FileUtil.readFileToString(new File(Environment.WEB_REALPATH+"js/ueditor/dialogs/template/files/preHtml_"+utc.getCode()+".html"), "utf-8"));
		utc.setHtml(FileUtil.readFileToString(new File(Environment.WEB_REALPATH+"js/ueditor/dialogs/template/files/html_"+utc.getCode()+".html"), "utf-8"));
		utcs.add(utc);
	}
	out.println(gson.toJson(utcs));
%>